#ifndef EXPERIMENTRESTORE_H
#define EXPERIMENTRESTORE_H

#include <QDialog>
#include <QMessageBox>
#include <QVariant>

#include "WLKService.h"
#include "global.h"
#include "Constant.h"
#include "ExperimentService.h"
#include "custommessagebox.h"

namespace Ui {
class ExperimentRestore;
}

class ExperimentRestore : public QDialog
{
    Q_OBJECT

public:
    explicit ExperimentRestore(QWidget *parent = nullptr);
    ~ExperimentRestore();

private:
    Ui::ExperimentRestore *ui;

signals:
    void analysisExperiment(WLKData wlkImportData);

public:
    void renderExperimentNameList();

protected:
    void closeEvent(QCloseEvent *event);

private:
    bool isValid;
    bool deviceIsExistence;
    ConnectedDeviceStruct cDevS;
    CustomMessageBox *cusMsg;
    ExperimentService *experimentService;
    int totalCycling;
    QString currentDirPath;
    QString currentDir;
    QString experimentName;
    QString filePath;
    QString id;
    QList<HuiFuData> huiFuData;
    QList<QHash<QString, QString>> experimentList;
    QList<QList<QHash<QString,QString>>> saveYingguangDataList;

    WLKData wlkImportData;
    WLKService *wlkService;

private:
    void allComponentsValid();
    void allComponentsInvalid();
    void communicationHuiFu();
    void restoreExperiment();
    void readyRestoring();
    void sleep(int msec);

};

#endif // EXPERIMENTRESTORE_H
